#ifndef GENERATOR_H_
#define GENERATOR_H_

#include "misc.h"
#include <math.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include "load_file.h"

typedef struct dict{
	int numWords;
	LONG_INDEX_PROJ sumWordsPowered;
	unsigned char *wordSize;
	char **words;
	char *fPtr;
} Dict;

typedef struct rule{
	Dict dict;
	int numBlocks;
	LONG_INDEX_PROJ *blockRange;
	char **block;
}Rule;

int generator(LONG_INDEX_PROJ k, Rule* ruleData, char* buffer);
long SizeOfDictionary(char type, Dict* dictData);
long HowManyOptionsForSagment(int min, int max, char type, Dict* dictData);
int SizeOfAlfabet(char type, Dict* dictData);
int K_to_password_subrule(LONG_INDEX_PROJ k, char* rule, char* buffer, Dict* dictData);
int generateWord(char type, LONG_INDEX_PROJ k, char **buffer, Dict* dictData);
int generateLetter(int min, int max,char type, LONG_INDEX_PROJ k, char **buffer, Dict* dictData);
char translate_index_to_char(int index, char type);
char translate_index_to_char_all(int index);
char translate_index_to_char_digits(int index);
char translate_index_to_char_letters(int index);
char translate_index_to_char_alphanumeric(int index);
Rule *PPRule(char *filename, char *rule);
void free_PPRule(Rule *r);

#endif /* GENERATOR_H_ */
